<template>
  <div style="height: 50px">
    <el-form :model="searchForm" :inline="true">
      <template v-for="(item, index) in items">
        <template v-if="['text', 'number'].indexOf(item.type) != -1">
          <el-form-item :label="item.label" :key="index">
            <el-input
              :clearable="true"
              :placeholder="item.placeholder"
              v-model="searchForm[item.name]"
              @clear="$emit('list')"
              @change="$emit('search')"
            ></el-input>
          </el-form-item>
        </template>
        <template v-if="['selection'].indexOf(item.type) != -1">
          <el-form-item :label="item.label" :key="index">
            <el-selection></el-selection>
          </el-form-item>
        </template>
      </template>

      <el-form-item>
        <el-button type="primary" icon="el-icon-search" @click="$emit('search')"
          >查询</el-button
        >
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
export default {
  name: "QueryForm",
  props: {
    items: {
      type: Array,
      default: () => {},
    },
    searchForm: {
      type: Object,
      default: () => {},
    },
  },
};
</script>
<style lang=""></style>
